From 721595edeaf270268b282769f9e91b6c40be4f75 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 16 Dec 2019 11:28:21 -0500 Subject: [PATCH] file transfer: Fix build on non-Linux O_PATH and O_CLOEXEC are not universally available. --- gdk/filetransferportal.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gdk/filetransferportal.c b/gdk/filetransferportal.c index 97e4134651..ff9c799674 100644 --- a/gdk/filetransferportal.c +++ b/gdk/filetransferportal.c @@ -26,6 +26,16 @@ #include #include +#ifndef O_PATH +#define O_PATH 0 +#endif + +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#else +#define HAVE_O_CLOEXEC 1 +#endif + #include "filetransferportalprivate.h" static GDBusProxy *file_transfer_proxy = NULL; @@ -158,6 +168,10 @@ add_files (GDBusProxy *proxy, g_object_unref (fd_list); return; } + +#ifndef HAVE_O_CLOEXEC + fcntl (fd, F_SETFD, FD_CLOEXEC); +#endif fd_in = g_unix_fd_list_append (fd_list, fd, &error); close (fd); -- 2.30.2